package com.amsure.controller;

import com.alibaba.fastjson.JSONObject;
import com.amsure.entity.BaseCommonEntity;
import com.amsure.service.AccountChargeService;
import com.amsure.service.InformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * @author xing1
 * @date 2021/8/20
 * @ddescription: 获取前端发送的信息
 */
@RestController
@RequestMapping(value = "/information", method = RequestMethod.POST)
public class InformationController {
    @Autowired
    private InformationService informationService;
    @Autowired
    private AccountChargeService accountChargeService;
    @RequestMapping("/electriccharge")
    @ResponseBody
    public HashMap<String, Object> test(@RequestBody JSONObject jsonObject) throws Exception {
        String jsonString = jsonObject.toJSONString();
        BaseCommonEntity informationBaseCommonEntity = informationService.getInformation(jsonString);
        return accountChargeService.sendElectricChargePost(informationBaseCommonEntity);

    }

}
